<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />    	
    <LINK rel="Bookmark" href="/favicon.ico" >
    <LINK rel="Shortcut Icon" href="/favicon.ico" />
    <!--[if lt IE 9]>
    <script type="text/javascript" src="libs/html5.js"></script>
    <script type="text/javascript" src="libs/respond.min.js"></script>
    <script type="text/javascript" src="libs/PIE_IE678.js"></script>
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="libs/h-ui/css/H-ui.min.css" />
    <link rel="stylesheet" type="text/css" href="libs/h-ui.admin/css/H-ui.admin.css" />
    <link rel="stylesheet" type="text/css" href="libs/Hui-iconfont/1.0.7/iconfont.css" />
    <link rel="stylesheet" type="text/css" href="libs/icheck/icheck.css" />
    <link rel="stylesheet" type="text/css" href="libs/h-ui.admin/skin/default/skin.css" id="skin" />
    <link rel="stylesheet" type="text/css" href="libs/h-ui.admin/css/H-ui.login.css" />
    <!--[if IE 6]>
    <script type="text/javascript" src="http://lib.h-ui.net/DD_belatedPNG_0.0.8a-min.js" ></script>
    <script>DD_belatedPNG.fix('*');</script>
    <![endif]-->  
    <title>首页-自动化测试平台</title>
    </head>
<body> 
<header class="navbar-wrapper">
    <div class="navbar navbar-fixed-top">
        <div class="container-fluid cl"> <a class="logo navbar-logo f-l mr-10 hidden-xs" href=""><span id="siteName"></span></a> <a class="logo navbar-logo-m f-l mr-10 visible-xs" href="">神州数码</a> <span class="logo navbar-slogan f-l mr-10 hidden-xs" id="version"></span> <a aria-hidden="false" class="nav-toggle Hui-iconfont visible-xs" href="javascript:;">&#xe667;</a>
            <nav class="nav navbar-nav">
                <ul class="cl">
                    <li class="dropDown dropDown_hover">
                    	<a href="javascript:;" class="dropDown_A" id="system-type-name">切换系统<i class="Hui-iconfont">&#xe6d5;</i></a>
                        <ul class="dropDown-menu menu radius box-shadow">
                            <li><a system-type="interface" href="javascript:void(0)" class="switch-system"><i class="Hui-iconfont">&#xe654;</i>接口自动化</a></li>
							<li><a system-type="web" href="javascript:void(0)" class="switch-system"><i class="Hui-iconfont">&#xe6d2;</i>web自动化</a></li>	
							<li><a system-type="app" href="javascript:void(0)" class="switch-system"><i class="Hui-iconfont">&#xe708;</i>app自动化</a></li>
							<li><a system-type="manage" href="javascript:void(0)" class="switch-system"><i class="Hui-iconfont">&#xe62e;</i>平台管理</a></li>					                           
                        </ul>
                    </li>
                </ul>
            </nav>
            <nav id="Hui-userbar" class="nav navbar-nav navbar-userbar hidden-xs">
                <ul class="cl">
                    <li id="role_name"></li>
                    <li class="dropDown dropDown_hover"> <a href="#" class="dropDown_A" id="real_name"><i class="Hui-iconfont">&#xe6d5;</i></a>
                        <ul class="dropDown-menu menu radius box-shadow">
                            <li class="redirect-to-page"><a href="javascript:" onclick="to_changePasswd();">修改密码</a></li>
                            <li class="redirect-to-page"><a href="javascript:;" onclick="to_changeUser();">切换账户</a></li>
                            <li><a href="javascript:;" onclick="to_logout()">退出</a></li>
                        </ul>
                    </li>
                    <li id="Hui-msg"> <a _href="resource/user/mail.html" data-title="我的邮件" href="javascript:void(0)" title="消息" class="openIframeNew"><span class="badge badge-danger noReadMailNum"></span><i class="Hui-iconfont" style="font-size:18px">&#xe68a;</i></a> </li>
                    <li id="Hui-skin" class="dropDown right dropDown_hover"> <a href="javascript:;" class="dropDown_A" title="换肤"><i class="Hui-iconfont" style="font-size:18px">&#xe62a;</i></a>
                        <ul class="dropDown-menu menu radius box-shadow">
                            <li><a href="javascript:;" data-val="default" title="默认（黑色）">默认（黑色）</a></li>
                            <li><a href="javascript:;" data-val="blue" title="蓝色">蓝色</a></li>
                            <li><a href="javascript:;" data-val="green" title="绿色">绿色</a></li>
                            <li><a href="javascript:;" data-val="red" title="红色">红色</a></li>
                            <li><a href="javascript:;" data-val="yellow" title="黄色">黄色</a></li>
                            <li><a href="javascript:;" data-val="orange" title="绿色">橙色</a></li>
                        </ul>
                    </li>
                </ul>
            </nav>
        </div>
    </div>
</header>
<aside class="Hui-aside">
    <input runat="server" id="divScrollValue" type="hidden" value="" />
    <div class="menu_dropdown bk_2" id="menu">
        <!-- <dl id="menu-interface">
            <dt><i class="Hui-iconfont">&#xe636;</i> 接口自动化<i class="Hui-iconfont menu_dropdown-arrow">&#xe6d5;</i></dt>
            <dd>
                <ul>
                    <li><a _href="resource/message/interface.html" data-title="接口管理-接口自动化" href="javascript:void(0)">接口管理</a></li>
                    <li><a _href="resource/message/message.html" data-title="报文管理-接口自动化" href="javascript:void(0)">报文管理</a></li>
                    <li><a _href="resource/message/complexScene.html" data-title="组合场景-接口自动化" href="javascript:void(0)">组合场景</a></li>
                    <li><a _href="resource/message/setCategoryList.html" data-title="测试集管理-接口自动化" href="javascript:void(0)">测试集管理</a></li>
                    <li><a _href="resource/message/autoTest.html" data-title="测试执行-接口自动化" href="javascript:void(0)">测试执行</a></li>
                    <li><a _href="resource/message/report.html" data-title="测试报告-接口自动化" href="javascript:void(0)">测试报告</a></li>
                    <li><a _href="resource/message/autoTask.html" data-title="定时任务" href="javascript:void(0)">定时任务</a></li>
                </ul>
            </dd>
        </dl> 
         <dl id="menu-webscript">
            <dt><i class="Hui-iconfont">&#xe636;</i> web自动化<i class="Hui-iconfont menu_dropdown-arrow">&#xe6d5;</i></dt>
            <dd>
                <ul>
                    <li><a _href="resource/webscript/module.html" data-title="模块管理-web自动化" href="javascript:void(0)">模块管理</a></li>
                    <li><a _href="resource/webscript/task.html" data-title="任务管理-web自动化" href="javascript:void(0)">任务管理</a></li>
                </ul>
            </dd>
        </dl>      
        <dl id="menu-app">
            <dt><i class="Hui-iconfont">&#xe6a2;</i> APP自动化测试<i class="Hui-iconfont menu_dropdown-arrow">&#xe6d5;</i></dt>
            <dd>
                <ul>
                </ul>
            </dd>
        </dl>
        <dl id="menu-web">
            <dt><i class="Hui-iconfont">&#xe6d2;</i> 高级测试<i class="Hui-iconfont menu_dropdown-arrow">&#xe6d5;</i></dt>
            <dd>
                <ul>
                	<li><a _href="resource/advanced/mockTest.html" data-title="接口Mock-高级测试" href="javascript:void(0)">接口Mock</a></li>
                	<li><a _href="resource/advanced/interfaceProbe.html" data-title="接口探测-高级测试" href="javascript:void(0)">接口探测</a></li>
                    <li><a _href="nopower.html?v=2" data-title="批量比对-高级测试" href="javascript:void(0)">批量比对</a></li>
                    <li><a _href="resource/advanced/performanceTest.html " data-title="性能自动化-高级测试" href="javascript:void(0)">性能测试</a></li>
                </ul>
            </dd>
        </dl>
        <dl id="menu-setting">
            <dt><i class="Hui-iconfont">&#xe61d;</i> 测试配置<i class="Hui-iconfont menu_dropdown-arrow">&#xe6d5;</i></dt>
            <dd>
                <ul>
                	<li><a _href="resource/setting/dataPool.html" data-title="数据池-测试配置" href="javascript:void(0)">数据池</a></li>
                	<li><a _href="resource/setting/businessSystem.html" data-title="测试环境-测试配置" href="javascript:void(0)">测试环境</a></li>
                	<li><a _href="resource/setting/variable.html" data-title="变量模板-测试配置" href="javascript:void(0)">变量模板</a></li>
                	<li><a _href="resource/setting/queryDbList.html" data-title="数据源配置-测试配置" href="javascript:void(0)">数据源</a></li> 
                </ul>
            </dd>
        </dl>
        <dl id="menu-tool">
            <dt><i class="Hui-iconfont">&#xe63c;</i> 测试工具<i class="Hui-iconfont menu_dropdown-arrow">&#xe6d5;</i></dt>
            <dd>
                <ul>
                	<li><a _href="resource/util/excelTemplate.html" data-title="上传模板" href="javascript:void(0)">excel上传模板</a></li>               	
                    	<li><a _href="resource/util/formatJson.html" data-title="JSON格式化" href="javascript:void(0)">JSON格式化</a></li> 
                    	<li><a _href="resource/util/formatXml.html" data-title="XML格式化" href="javascript:void(0)">XML格式化</a></li> 
                   		<li><a _href="reportHtml/神州数码接口自动化工具操作手册.pdf" data-title="操作手册" href="javascript:void(0)">操作手册</a></li>                  
                </ul>
            </dd>
        </dl>
        
        <dl id="menu-baobiao">
            <dt><i class="Hui-iconfont">&#xe61e;</i> 统计报表<i class="Hui-iconfont menu_dropdown-arrow">&#xe6d5;</i></dt>
            <dd>
                <ul>
                	<li><a _href="resource/reporting/callMap.html" data-title="服务调用地图-统计报表" href="javascript:void(0)">服务调用地图</a></li>
                    <li><a _href="nopower.html?v=4" data-title="周期报表-统计报表" href="javascript:void(0)">周期报表</a></li>
                    <li><a _href="nopower.html?v=5" data-title="配置选项-统计报表" href="javascript:void(0)">报表配置</a></li>
                </ul>
            </dd>
        </dl>
        <dl id="menu-user">
            <dt><i class="Hui-iconfont">&#xe62c;</i> 个人设置<i class="Hui-iconfont menu_dropdown-arrow">&#xe6d5;</i></dt>
            <dd>
                <ul>
                    <li><a _href="resource/user/mail.html" data-title="我的消息" href="javascript:void(0)">我的消息</a></li>
                </ul>
            </dd>
        </dl>
        <dl id="menu-system" class="adminPower">
            <dt><i class="Hui-iconfont">&#xe62b;</i> 用户角色<i class="Hui-iconfont menu_dropdown-arrow">&#xe6d5;</i></dt>
            <dd>
                <ul>
                    <li><a _href="resource/user/user.html" data-title="用户管理" href="javascript:void(0)">用户管理</a></li>
                    <li><a _href="resource/user/role.html" data-title="角色权限" href="javascript:void(0)">角色管理</a></li>
                </ul>
            </dd>
        </dl>
        <dl id="menu-system" class="adminPower">
            <dt><i class="Hui-iconfont">&#xe63c;</i> 系统管理<i class="Hui-iconfont menu_dropdown-arrow">&#xe6d5;</i></dt>
            <dd>
                <ul>               	
                	
                    <li><a _href="resource/system/opInterface.html" data-title="操作接口" href="javascript:void(0)">操作接口</a></li>
                    <li><a _href="resource/system/logRecord.html" data-title="系统日志" href="javascript:void(0)">系统日志</a></li>                                       
                    <li><a _href="resource/system/globalSetting.html" data-title="全局配置" href="javascript:void(0)">全局配置</a></li>                   
                    <li><a _href="druid/index.html" data-title="Web监控" href="javascript:void(0)">Web监控</a></li>
                </ul>
            </dd>
        </dl>  -->     
    </div>
</aside>
<div class="dislpayArrow hidden-xs"><a class="pngfix" href="javascript:void(0);" onClick="displaynavbar(this)"></a></div>
<section class="Hui-article-box">
    <div id="Hui-tabNav" class="Hui-tabNav hidden-xs">
        <div class="Hui-tabNav-wp">
            <ul id="min_title_list" class="acrossTab cl">
                <li class="active"><span title="我的工作台" data-href="A_welcome.html">我的工作台</span><em></em></li>
            </ul>
        </div>
        <div class="Hui-tabNav-more btn-group"><a id="js-tabNav-prev" class="btn radius btn-default size-S" href="javascript:;"><i class="Hui-iconfont">&#xe6d4;</i></a><a id="js-tabNav-next" class="btn radius btn-default size-S" href="javascript:;"><i class="Hui-iconfont">&#xe6d7;</i></a></div>
    </div>
    <div id="iframe_box" class="Hui-article">
        <div class="show_iframe">
            <div style="display:none" class="loading"></div>
            <iframe scrolling="yes" frameborder="0" src="" name="welcome"></iframe>
        </div>
    </div>
    <input type="hidden" id="user_id"/>
    <input type="hidden" id="token"/>
    <input type="hidden" id="backUrl"/>
</section>

<div class="contextMenu" id="Huiadminmenu">
	<ul>
		<li id="closethis">关闭当前 </li>
		<li id="closeall">关闭全部 </li>
		<li id="closeother">关闭其他 </li>
</ul>
</div>
<div id="templates-page" style="display: none;"></div>
<div id="children-page" style="display: none;"></div>
<div id="menu-page" style="display: none;"></div>
<script type="text/javascript" src="libs/jquery/1.9.1/jquery.js"></script>
<script type="text/javascript" src="libs/layer/2.1/layer.js"></script>
<script type="text/javascript" src="libs/h-ui/js/H-ui.js"></script>
<script type="text/javascript" src="libs/h-ui.admin/js/H-ui.admin.js"></script>
<script type="text/javascript" src="libs/handlebars.js"></script>
<script type="text/javascript" src="libs/jquery.contextmenu/jquery.contextmenu.r2.js"></script>
<script type="text/javascript" src="js/requestUrls.js"></script>
<script type="text/javascript">
	var templates;
	var htmls; 
	var explanationMarks;
	var menuJson;
    $(document).ready(function() {  
    	//初始化加载菜单
    	loadMenuTemplate();
    	
    	$('iframe').attr("src", "welcome.html");
    	
    	/***********通过外部登录的方式打开首页****************/
    	var token = GetQueryString("token");
    	var backUrl = GetQueryString("backUrl");   	
    	$("#token").val(token);
    	$("#backUrl").val(backUrl == null ? "login.html" : "http://" + backUrl);    	
    	if (token != null && token != "") {
    		$(".redirect-to-page").hide();
    	}

    	/***************************/
    	
    	$(".openIframeNew").on("click",function(){
    		Hui_admin_tab(this);
    	});  
    	
    	/*******************初始化子iFrame中的模板和远程子页面html代码***************************/
    	//模板id
    	templates = initHandlebarsTemplate();
    	
    	
    	//页面名
    	htmls = loadChildrenHtml(["interfaceParameter-viewTree",
    	                          "messageScene-test",
    	                          "messageScene-validateFullJson",
    	                          "messageScene-validateKeyword",
    	                          "role-power",
    	                          "viewWindow"]);
    	/*****************************************************/
    	
    	$.getJSON("./js/json/explanationMarks.json", function(json){
    		explanationMarks = json;
    	});
    });
    
    /*************预先编译子iframe中的模板***************/
    function initHandlebarsTemplate () {
    	var templates = {};
    	$("#templates-page").load("./resource/template/customTemplate.htm", function() {
    		$("#templates-page > script").each(function(i, n){
    			templates[$(n).attr('id')] = Handlebars.compile($(n).html());   			
    		});  		  		
    	});
    	return templates;
    }
    
    /********************加载菜单***************************/
    function loadMenuTemplate() {
    	$.getJSON("./js/json/menu.json", function(json){
    		menuJson = json;
    		$("#menu-page").load("./resource/template/menuTemplate.htm", function(){
    			templates['menu-template'] = Handlebars.compile($("#menu-page > script").html());
    			loadMenu(getCookie('menuType'), true);
    			$(".switch-system").click(function(){
    				var name = loadMenu($(this).attr('system-type'));
    				name && (layer.msg('已切换至系统：' + name, {time:2000}));    			
    			});
    		})
    	});
    } 
    
    function loadMenu(menuType, init) {
    	if (menuType == null) {
    		menuType = "interface";
    	}    	
		if (menuType == getCookie('menuType') && !init) {
    		return null;
    	}   	   	
    	$("#menu").html(templates['menu-template'](menuJson[menuType]['menu']));
    	//重新初始化菜单效果
    	$.Huifold(".menu_dropdown dl dt",".menu_dropdown dl dd","fast",3,"click");
    	//第一个菜单为打开状态
    	$("#menu dt:eq(0)").click();
    	//如果切换的是其他的系统菜单，则关闭全部的Tab选项卡    	 
    	$("#min_title_list li i").trigger("click");
    	setCookie("menuType", menuType);
    	$("#system-type-name").html(menuJson[menuType]['name'] + '<i class="Hui-iconfont">&#xe6d5;</i>');
    	return menuJson[menuType]['name'];
    }
    /*****预先加载子页面代码到内存*******/
    function loadChildrenHtml (options) {
    	if (options == null || typeof options != 'object') {
    		return false;
    	}
    	var htmls = {};
    	$.each(options, function (i, n) {
    		$("#children-page").append('<div id="' + n + '"></div>');  
    		$("#" + n).load("./resource/template/" + n + ".htm", function() {
    			htmls[n] = $("#" + n).html();
    			$("#" + n).html('');
    		});
    	});
    	return htmls;
    }
    
    /***********修改密码*********/
    function to_changePasswd() {
    	layer.prompt({
  		  formType: 1,
  		  value: '',
  		  title: '验证旧密码'
  		}, function(value, index, elem){
  			layer.close(index);
  		  $.post("user-verifyPasswd", {password: value}, function (data) {
  			 if (data.returnCode == 0) {
  				 layer.prompt({
  					  formType: 1,
  					  value: '',
  					  title: '请输入新密码'
  					}, function(value1, index1, elem){
  						layer.close(index1);
  						layer.confirm('确定要将密码修改为"' + value1 + '"吗？', {icon:0, title:'警告'}, function(index2) {
  							layer.close(index2);
  				    		$.get("user-modifyPasswd",{password:value1}, function(data) {
  				    			if (data.returnCode == 0) {
  				                    layer.msg('密码修改成功,设置自动登录的需要重新输入密码!', {icon:1, time:1500});
  				        		} else {
  				        			layer.alert(data.msg, {icon: 5});
  				        		}
  				    		});
  				    		
  				    	});
  					});
  			 }else{
  				 layer.alert(data.msg, {icon:5});
  			 }
  		  });
  		});
    }
   
    /***********手动点击logout会清除登录信息cookie*********/ 
    function to_logout(){
    	$.get("user-logout",function(data){
    		if(data.returnCode==0){
    			clearCookie("username");
    			clearCookie("password");
    			window.location.href = $("#backUrl").val();
    		}
    	});    	
    }

    /***********切换用户*********/ 
    function to_changeUser(){
    	var loginHtml ='<form class="form form-horizontal" action="index.html" method="post" style="width:485px;">'+
					            '<div class="row cl">'+
					                '<label class="form-label col-xs-3"><i class="Hui-iconfont">&#xe60d;</i></label>'+
					                '<div class="formControls col-xs-8">'+
					                    '<input id="username"  type="text" placeholder="账户" class="input-text size-L">'+
					                '</div>'+
					            '</div>'+
					            '<div class="row cl">'+
					                '<label class="form-label col-xs-3"><i class="Hui-iconfont">&#xe60e;</i></label>'+
					                '<div class="formControls col-xs-8">'+
					                    '<input id="password"  type="password" placeholder="密码" class="input-text size-L">'+
					                '</div>'+
					            '</div>'+
					            '<div class="row cl">'+
					                '<div class="formControls col-xs-8 col-xs-offset-3">'+
					                    '<input id="loginBtn" type="button" class="btn btn-success radius size-L" value="&nbsp;登&nbsp;&nbsp;&nbsp;&nbsp;录&nbsp;">&nbsp;'+
					                    '<input name="" type="reset" class="btn btn-default radius size-L" value="&nbsp;取&nbsp;&nbsp;&nbsp;&nbsp;消&nbsp;">'+
					                    '<p id="loginTip" style="color: red;"></p>'+
					                '</div>'+
					            '</div>'+
					        '</form>';
					
    	var index = layer.open({
  		  title:'切换用户',
  		  type: 1,
  		  area: ['500px', '280px'], 
  		  content: loginHtml
  		});
    	$("#loginBtn").click(userLogin);
   	 		//监听键盘回车事件
   		 $(document).keyup(function (event) {
   		 var keycode = event.which;
   		 if(keycode==13){
   			 $("#loginBtn").click(); 
   		 }  		 
   	 });
   		$("#username").trigger("focus").trigger("select");
    }
    
    /**切换用户时的登录页面*/
    function userLogin(){
        var username = $("#username").val();
        var password = $("#password").val();
        var tipMsg = $("#loginTip");
        if(username != "" && username != null && password != "" && password != null){
            $.post("user-toLogin",{
                username:username,
                password:password
            },function(data){
                if(data.returnCode==0){
                	location.reload();
                }else if (data.returnCode==2){
                    layer.alert(data.msg, {icon: 4}); 
                }else {
                	 tipMsg.text(data.msg);
                }
            });
        }else{
            tipMsg.text("请填写完整再提交登录");
        }
    }
    
    /*****************************其他***********************************/
    /**null转换空字符串**/
    Handlebars.registerHelper('inputValue', function(value, defaultValue){  	
		if (value == null || value.length == 0) {
			value = defaultValue;
		}

		return value;
	});
    
    /**结果标签展示**/
    Handlebars.registerHelper('resultLabelView', function(status){
    	var color = "";
		var flag = "";
		if (status == "0") {
			color = "success";
			flag = "SUCCESS";
		} else if (status == "1") {
			color = "danger";
			flag = "FAIL";
		} else {
			color = "default";
			flag = "STOP";
		}

		return '<span class="label label-' + color + ' radius">' + flag + '</span>';
    });	
    
    
    Handlebars.registerHelper('if_eq', function(v1, v2, opts) {
        if(v1 == v2)
            return opts.fn(this);
        else
            return opts.inverse(this);
    });
    
    
    Handlebars.registerHelper('validate_path', function(v1) {
        if (v1 && !isJSON('{' + v1 + '}')) {
        	return v1 + ".";
        }
        
        return "";
    });
    
	/**
	 * 获取地址栏参数
	 * @param name
	 * @returns
	 */
	function GetQueryString(name) {
		var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
		var r = window.location.search.substr(1).match(reg);
		if (r != null)
			return decodeURIComponent(r[2]);
		return null;
	}
	
	/**
	 * 判断是否为json格式字符串
	 * @param str
	 */
	function isJSON(str) {
	    if (typeof str == 'string') {
	        try {
	            var obj=JSON.parse(str);
	            if(typeof obj == 'object' && obj ){
	                return true;
	            }else{
	                return false;
	            }

	        } catch(e) {
	            console.log('error：'+str+'!!!'+e);
	            return false;
	        }
	    }
	    console.log('It is not a string!')
	}
</script>
</body>
</html>